<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        function checkAll(obj) {
            let flag = obj.checked;
            let items = document.getElementsByName("item");
            for (let i = 0; i < items.length; i++) {
                let item = items[i];
                item.checked = flag;
            }
        }

        function reverseSelect() {
            let items = document.getElementsByName("item");
            for (let i = 0; i < items.length; i++) {
                let item = items[i];
                item.checked = ! item.checked;
            }
        }
    </script>
</head>
<body>
    <h3>商品价格列表</h3>
    <input type="checkbox" name="item" value="1500" /> 山地自行车1500<br />
    <input type="checkbox" name="item" value="200"  /> 时尚女装200<br />
    <input type="checkbox" name="item" value="3000"  /> 笔记本电脑3000元<br />
    <input type="checkbox" name="item" value="800"  /> 情侣手表800<br />
    <input type="checkbox" name="item" value="2000"  /> 桑塔纳2000<br />
    <hr/>
    <!-- TODO:1.确定事件 给"全选/全不选"复选框绑定单击事件
        this: 写在哪个标签上就代表那个标签对象
    -->
    <input type="checkbox" id="all" onclick="checkAll(this)"  />全选/全不选 &nbsp;
    <input type="button" id="reverse" onclick="reverseSelect()"  value=" 反 选 "/>&nbsp;
</body>
</html>